// ChCConnectionSettingsDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ChatServer.h"
#include "ChSSettingsDlg.h"


// CChSSettingsDlg dialog

IMPLEMENT_DYNAMIC(CChSSettingsDlg, CDialog)

CChSSettingsDlg::CChSSettingsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CChSSettingsDlg::IDD, pParent)
	, m_strHostName(_T(""))
	, m_uPort(0)
{

}

CChSSettingsDlg::~CChSSettingsDlg()
{
}

void CChSSettingsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_strHostName);
	DDX_Text(pDX, IDC_EDIT2, m_uPort);
	DDV_MinMaxUInt(pDX, m_uPort, 1, 99999);
}

INT_PTR CChSSettingsDlg::SetupSettings()
{
	CChSSettingsDlg dlg;
	CChSSettings *pSettings = CChSSettings::Instance();
	pSettings->ReadSetings();
	dlg.HostName(pSettings->HostName());
	dlg.Port(pSettings->Port());
	
	INT_PTR nRet = dlg.DoModal();
	if(IDOK == nRet)
	{
		pSettings->HostName(dlg.HostName());
		pSettings->Port(dlg.Port());
		pSettings->SaveSettings();
	}

	return nRet;
}


BEGIN_MESSAGE_MAP(CChSSettingsDlg, CDialog)
END_MESSAGE_MAP()


// CChSSettingsDlg message handlers
